<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../res/css/weui.css"/>
    <link rel="stylesheet" href="../res/css/weuix.css"/>
    <link rel="stylesheet" href="../res/css/common.css"/>
    <script src="../res/js/zepto.min.js"></script>
    <script src="../res/js/zepto.weui.js"></script> 
    <script src="../res/js/common.js?v=2"></script>
    <script src="../res/js/template-web.js"></script>
    <script type="text/javascript">
    var log_id = getQst('log_id'),inquiryPatientId='';
    $(function(){
        // 后退
        $('#btnBack').click(function(){
			goPageNo(-1);
		})
		$('.changeShow').click(function(){
			index = $(this).attr('index');
			$(this).addClass('active').siblings('.active').removeClass('active');
			if(index==1){
				$('.show1').removeClass('disappear')
				$('.show2').addClass('disappear')
			}else{
				$('.show2').removeClass('disappear')
				$('.show1').addClass('disappear')
			}
		})
		var paramJson = { "id": log_id};			//log_id
        newAjaxPost("/h5/myInterrogation/getInterrogationHistoryinfo", paramJson, doOk);

        function doOk(jsonInfo) {
			var show1List = '',show2List = '';
            $('.show2').addClass('disappear')
            if(jsonInfo.code == "1"){
                 //生成html片段
                var html = template("inquiryDetail",jsonInfo.data);
                var container = document.getElementById("detail_data");
                //将html片段渲染到界面中
                container.innerHTML = html;
				
				// 问诊诊断
				if(jsonInfo.data.mainSuit){
					show1List+='<div class="inquiryMap_box_height">症状：'+jsonInfo.data.mainSuit+'</div>'
				}else{
					show1List+='<div class="inquiryMap_box_height">症状：无</div>'
				}
				if(jsonInfo.data.diagnosisDescribe){
					show1List+='<div class="inquiryMap_box_height">诊断结果：'+jsonInfo.data.diagnosisDescribe+'</div>'
				}else{
					show1List+='<div class="inquiryMap_box_height">诊断结果：无</div>'
				}
				$('.show1').html(show1List)
				inquiryPatientId = jsonInfo.data.inquiryPatientId
				// 处方列表
				if(jsonInfo.data.prescriptionListResq != ''){
					for(var i = 0;i<jsonInfo.data.prescriptionListResq.length;i++){
						show2List+='<div class="view_felx title" ><div>处方类型</div><div>审核状态</div><div>作废原因</div></div>'
						show2List+='<div class="log_list">'
						show2List+='<div class="view_felx prescriptionList">'
						if(jsonInfo.data.prescriptionListResq[i].prescriptionType==2){
							show2List+='<div>西药</div>'
						}else{
							show2List+='<div>中药</div>'
						}
						if(jsonInfo.data.prescriptionListResq[i].prescriptionState==1){
							show2List+='<div>药师审核通过</div>'
						}else if(jsonInfo.data.prescriptionListResq[i].prescriptionState==2){
							show2List+='<div class="colorred">药师审核驳回</div>'
						}else{
							show2List+='<div>药师审核中</div>'
						}
						if(jsonInfo.data.prescriptionListResq[i].prescriptionReasonsInvalidation){
							show2List+='<div class="colorred" >'+jsonInfo.data.prescriptionListResq[i].prescriptionReasonsInvalidation+'</div>'
						}else{
							show2List+='<div >-</div>'
						}
						show2List+='</div>'
						show2List+='<div class="view_btn"><button class="button detalis goMed" num="'+jsonInfo.data.prescriptionListResq[i].id+'">用药详情</button><button class="button detalis goOrder" num="'+jsonInfo.data.prescriptionListResq[i].prescriptionNo+'">查看处方</button></div>'
						show2List+='</div>'
					}
				}else{
					show2List+='<div class="nolog_list">无</div>'
				}
				$('.show2').html(show2List)
            }
            // 处方按钮
            if(jsonInfo.data.prescriptionListResq.length  == 0){
                $('.log_list').css({'display':'none'});
				$('.title').css({'display':'none'});
            }else{
				$('.nolog_list').css({'display':'none'});
                  //生成html片段
                var orderHtml = template("orderBtnList",jsonInfo);
                var orderContainer = document.getElementById("order_btn");
                //将html片段渲染到界面中
                orderContainer.innerHTML = orderHtml;
            } 
			
			$('.goMed').on('click',function(){
				var id = $(this).attr('num');
				goPage('inquiry_go_med.htm?order_id='+id)
			})
			$('.goOrder').on('click',function(){
				var prescriptionNo = $(this).attr('num');
				goPage('inquiry_go_order.htm?order_id='+prescriptionNo)
			})
			$('.goRecord').on('click',function(){
				goPage('inquiry_go_record.htm?log_id='+inquiryPatientId)
			})
        }
    })
    </script>
</head>
<style>
    .all{background: white; margin: 10px;  border-radius: 10px;overflow: hidden;}
	.body_bottom{padding: 10px;}
    .body_top>p,.body_bottom>p{    font-size: 16px; color: #353535;}
    .body_top>div{display: flex; justify-content: space-between; }
    .blackFont{font-size: 16px; font-weight: bold;}
    .weui-btn_mini{padding: 0 1em;line-height: 2;font-size: 12px;}
	.weui-btn.weui-btn_mini.weui-btn_primary{
		border: 1px solid #1189ff;
		border-radius: 10px;
		color: #1189ff;
	}
    footer{text-align: center;}
    footer>.weui-btn_mini{font-size: 18px; font-weight: bold; margin: 0 10px;}
    #order_btn{display: flex; justify-content: space-around; margin-top: 5px;}
    #order_btn>div,.footer_btn{font-size: 18px; font-weight: bold; background: #FCA92B; border-radius: 10px; color: white; padding:4px 18px;}
	.weui-btn:after { content: none;}
	.home_icon_img div {
		display: block;
		border:0 !important;
		margin:0 !important;
		background-color: unset !important;
		color: unset !important;
		text-align: unset;
		width: unset;
	}
	.brief_introduction span{color: #2b73cc;}
	
	.inquiryMaplist {
	    margin-top: 10px;
	    background: #fff;
	    text-align: center;
	    border-bottom: 1px solid #f8f7f7;
	}
	.view_felx {
	    display: flex;
	}
	.view_felx div {
	    flex: 1;
	}
	.inquiryMaplist div span {
	    padding: 10px;
	    display: inline-block;
	}
	.inquiryMaplist div.active span {
	    border-bottom: 1px solid #f9a821;
	    color: #1189ff;
	}
	.inquiryMap_box {
	    background: #fff;
	    padding: 10px;
	}
	.inquiryMap_box view.inquiryMap_box_height {
	    max-height: 100px;
	    padding: 10px 0;
	}
	.title {
	    color: #999;
	}
	.inquiryMap_box div.view_felx {
	    text-align: center;
	}
	.prescriptionList {
	    padding: 10px 0;
	}
	.view_btn {
	    text-align: right;
	    padding: 10px 10px 8px;
	    background: #fff;
	    border-bottom: 1px solid #f8f7f7;
	}
	button.detalis {
	    background: none;
	    color: #1189ff;
	    border: 1px solid #1189ff;
	    border-radius: 10px;
	}
	.view_btn button {
	    width: 75px;
	    height: 25px;
	    display: inline-block;
	    font-size: 13px;
	    line-height: 25px;
	    margin: 0 0 0 10px;
	    border-radius: 2px;
	    background: none;
	    color: #1189ff;
	    border: 1px solid #1189ff;
	}
	.disappear{display: none;}
	.colorred{color: #e70000;}
</style>
<body ontouchstart">
    <header>
        <div class="fixed-top">
            <div class="weui-btn_primary weui-header">
                <div class="weui-header-left" id="btnBack"><a  class="icon icon-109"></a></div>
                <h1 class="weui-header-title">问诊详情</h1>
            </div>
        </div>
    </header>
    <!-- 主体 -->
    <div id="detail_data">
    </div>
    <div id="order_btn">
    </div>
	<div class="all">
		<div class="view_felx inquiryMaplist">
		    <div class="changeShow active" index="1"><span>问诊诊断</span></div>
		    <div class="changeShow" index="2"><span>处方列表</span></div>
		</div>
		<div class="inquiryMap_box show1" >
		    <!-- <div class="inquiryMap_box_height">症状：{{mainSuit? mainSuit:'无'}}</div>
		    <div  class="inquiryMap_box_height">诊断结果：{{diagnosis? diagnosis:'无'}}</div> -->
		</div>
		<div class="inquiryMap_box show2" >
		</div>
	</div>
</body>

<script id="inquiryDetail" type="text/html">
    <section>
		<div class="expertlist_map" >
			<div class="expertlist_map_top to_detail" num="0" id="' + data[i].id + '" >
				<div class="expertlist_map_img"> <img src="{{doctorHeadImg}}" /> </div>
				<div class="doctor_info">
					<div class="doctor_name">{{trueName}}<span>{{doctorEducation}}</span>   <span>{{departmentName}}</span></div>
					<div class="age">限 <span>{{workYear}}年</span> 　年龄 <span>{{age}}岁</span></div>
				</div>
			</div>
			<div class="brief_introduction uni-ellipsis-2 to_detail" num="0" id="' + data[i].id + '"><span>简介:</span>{{doctorSynopsis}}</div>
			<div class="brief_introduction uni-ellipsis-2 to_detail" num="0" id="' + data[i].id + '"><span>擅长:</span>{{doctorSpecialty}}</div>
			<div class=" home_icon_img">
				<div>问诊时间： {{createTime}}</div>
				<div>问诊方式：{{inquiryType == 1 ? '视频问诊' : '图文问诊'}}</div>
			</div>
		</div>
		
		
		
		</section>
		<footer style="display: flex; justify-content: space-around;">
			<div style="display: flex;justify-content: space-around;margin-top: 5px;">
				<div style="background:#1189ff;" class='footer_btn goRecord'  >查看病历</div>
			</div>
            <div id="order_btn">
				<span style="color:red;">本次问诊并没有开具处方！</span>
            </div>
		</footer>
	</script>
	<script id="orderBtnList" type="text/html">
		{{each orderlist as value}}
		<div onclick="goPage('inquiry_go_order.htm?order_id='+value.prescription_id)">查看处方</div>
		{{/each}}
	</script>
</html>